< previous page page_201 next page >

Page 201
The Mid$() functions first parameter is the string you wish to retrieve the some characters from. The 2nd parameter is the character position you wish to start with. The 3rd parameter is how many of the next characters you want to retrieve.
Len( )
Len() returns the number of characters in a string. Heres an example:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdLen_Click ()
   Dim strName As String
   strName = "Bill Gates"

   Me.Cls
   Me.Print "strName = " & strName
   Me.Print "Len(strName) = " & Len(strName)
End Sub
Replace
The Replace function allows you to substitute one character (or characters) in a string with another character (or characters). Heres an example:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdReplace_Click()
   Dim strValue As String

   strValue = "Microsoft Visual Basic 5.0"
   Me.Cls
   Me.Print "strValue = " & strValue
   MsgBox "Replace(strValue, ""5.0"", ""6.0"") = " _
           & Replace(strValue, "5.0", "6.0")
End Sub
The Replace() function will find values in the first parameter that match the 2nd parameter, and replace those characters with the values in the 3rd parameter.
9f31265bb40b592b1929e18a47ab28e5.gif
NOTE
The following functions do not have corresponding buttons in the example.

 
< previous page page_201 next page >

If you like this book, buy it!